package com.ec.file.service;

import com.aliyun.oss.ClientException;
import com.aliyun.oss.OSSException;
import org.springframework.web.multipart.MultipartFile;

import java.io.File;
import java.io.IOException;

/**
 * <p>
 * OSS服务
 * </p>
 *
 * @author Eric Lee
 * @since 2019-07-18 15:34
 */
public interface IOssService {

    /**
     * 保存图片到本地，返回保存地址(包括文件名
     *
     * @param file
     * @param savePath
     * @param isRename
     * @return
     * @throws IOException
     */
    String fileUpload2Local(MultipartFile file, String savePath, Boolean isRename) throws IOException;


    /**
     * 上传到阿里云oss，返回oss的保存路径
     *
     * @param file
     * @return
     * @throws OSSException
     * @throws ClientException
     */
    String fileUpload2Oss(File file, Boolean isRename) throws OSSException, ClientException;


    /**
     * 网络图片上传到oss
     *
     * @param urlList
     * @param path
     * @param isRename
     * @return
     * @throws IOException
     */
    String webFileUpload2Oss(String urlList, String path, Boolean isRename) throws IOException;


}
